home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume12 / fm / patch01 < prev    next >
Encoding:
Text File  |  1990-05-19  |  8.4 KB  |  343 lines

  1. Newsgroups: comp.sources.misc
  2. From: tony@ajfcal.UUCP (Tony Field)
  3. subject: v12i110: fm patch01
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 12, Issue 110
  7. Submitted-by: tony@ajfcal.UUCP (Tony Field)
  8. Archive-name: fm/patch01
  9.  
  10. Hello Brandon,
  11.  
  12. Please accept this patch to "fm".
  13.    -----------------------------------------------
  14.  
  15. This patch to fm fixes cursor activity while editing a hex nibble, and
  16. corrects a problem that mis-formats the last 16 bytes of a file while
  17. saving to a print file.
  18.  
  19. tony..
  20. -----------------------------------------------------------------------
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of shell archive."
  28. # Contents:  patch01
  29. # Wrapped by tony@ajfcal on Wed May 16 19:49:28 1990
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'patch01' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'patch01'\"
  33. else
  34. echo shar: Extracting \"'patch01'\" \(6789 characters\)
  35. sed "s/^X//" >'patch01' <<'END_OF_FILE'
  36. XPrereq: 0
  37. X*** old/patchlevel.h
  38. X--- patchlevel.h
  39. X**************
  40. X*** 1
  41. X! #define PATCHLEVEL 0
  42. X--- 1 -----
  43. X! #define PATCHLEVEL 1
  44. X*** old/fm.c
  45. X--- fm.c
  46. X**************
  47. X*** 14,20
  48. X  
  49. X      Permission is given to distribute the source and documentation files
  50. X      and/or compiled binaries associated with fm as long as no monies are
  51. X!     exchanged for their use or distribution.
  52. X  
  53. X      No responsibility is taken for any errors on inaccuracies inherent
  54. X      either to the comments or the code of this program, but, if reported
  55. X--- 14,20 -----
  56. X  
  57. X      Permission is given to distribute the source and documentation files
  58. X      and/or compiled binaries associated with fm as long as no monies are
  59. X!     exchanged for their use.
  60. X  
  61. X      No responsibility is taken for any errors on inaccuracies inherent
  62. X      either to the comments or the code of this program, but, if reported
  63. X**************
  64. X*** 22,28
  65. X  
  66. X      Author:  Tony Field
  67. X               tony@ajfcal
  68. X- */
  69. X  
  70. X  #include <stdio.h>
  71. X  #include <sys/types.h>
  72. X--- 22,27 -----
  73. X  
  74. X      Author:  Tony Field
  75. X               tony@ajfcal
  76. X  
  77. X  Patchlevels
  78. X  ===========
  79. X**************
  80. X*** 24,29
  81. X               tony@ajfcal
  82. X  */
  83. X  
  84. X  #include <stdio.h>
  85. X  #include <sys/types.h>
  86. X  #include <sys/stat.h>
  87. X--- 23,36 -----
  88. X      Author:  Tony Field
  89. X               tony@ajfcal
  90. X  
  91. X+ Patchlevels
  92. X+ ===========
  93. X+ Patchlevel 1:    May-1990
  94. X+                 1. clean up cursor motion while editing hex side of screen.
  95. X+                 2. KEY_UNDO removed for M_TERMCAP compilation
  96. X+                 3. fixed file print on last 16 bytes of file
  97. X+ */
  98. X+ 
  99. X  #include <stdio.h>
  100. X  #include <sys/types.h>
  101. X  #include <sys/stat.h>
  102. X**************
  103. X*** 89,95
  104. X          ||  (statbuf.st_mode & S_IFMT) == S_IFREG)
  105. X          max_fpos = (long) statbuf.st_size;
  106. X      else
  107. X!         max_fpos = 1999999999;        /*    infinity??? */
  108. X  
  109. X      if ((fp = open (fname, O_RDWR)) == -1)
  110. X      {    if ((fp = open (fname, O_RDONLY)) == -1)
  111. X--- 96,102 -----
  112. X          ||  (statbuf.st_mode & S_IFMT) == S_IFREG)
  113. X          max_fpos = (long) statbuf.st_size;
  114. X      else
  115. X!         max_fpos = 0x7fffffffL;        /*    infinity??? */
  116. X  
  117. X      if ((fp = open (fname, O_RDWR)) == -1)
  118. X      {    if ((fp = open (fname, O_RDONLY)) == -1)
  119. X**************
  120. X*** 369,374
  121. X              fputc (hbuf[1], pfile);
  122. X              fputc (' ', pfile);
  123. X          }
  124. X          /*    display ascii side    */
  125. X          
  126. X          fprintf (pfile, "   ");
  127. X--- 376,385 -----
  128. X              fputc (hbuf[1], pfile);
  129. X              fputc (' ', pfile);
  130. X          }
  131. X+ 
  132. X+         for ( ; m % 16;  m++)
  133. X+             fprintf (pfile, "   ");
  134. X+ 
  135. X          /*    display ascii side    */
  136. X          
  137. X          fprintf (pfile, "   ");
  138. X**************
  139. X*** 402,407
  140. X      int        x, y;                /*    screen coords.                        */
  141. X      int        hexa, hexb, cbyte;    
  142. X      int        reflected;            /*    was a change really done            */
  143. X      
  144. X      if (byte_pos >= nbytes)        
  145. X          byte_pos = nbytes - 1;
  146. X--- 413,419 -----
  147. X      int        x, y;                /*    screen coords.                        */
  148. X      int        hexa, hexb, cbyte;    
  149. X      int        reflected;            /*    was a change really done            */
  150. X+     int        have_key;
  151. X      
  152. X      if (byte_pos >= nbytes)        
  153. X          byte_pos = nbytes - 1;
  154. X**************
  155. X*** 407,413
  156. X          byte_pos = nbytes - 1;
  157. X      if (byte_pos < 0)
  158. X          byte_pos = 0;
  159. X!         
  160. X      while (1)
  161. X      {
  162. X          mvwprintw (stdscr, 1, 6, "%lx     ",  fpos + byte_pos);
  163. X--- 419,426 -----
  164. X          byte_pos = nbytes - 1;
  165. X      if (byte_pos < 0)
  166. X          byte_pos = 0;
  167. X!     
  168. X!     have_key = 0;
  169. X      while (1)
  170. X      {
  171. X          mvwprintw (stdscr, 1, 6, "%lx     ",  fpos + byte_pos);
  172. X**************
  173. X*** 416,422
  174. X          wmove (stdscr, y, x);
  175. X          wrefresh (stdscr);
  176. X  #endif
  177. X!         key = mvwgetch (stdscr, y, x);
  178. X  
  179. X          switch (key)            /*    any user keys or function keys    */
  180. X          {
  181. X--- 429,436 -----
  182. X          wmove (stdscr, y, x);
  183. X          wrefresh (stdscr);
  184. X  #endif
  185. X!         if (have_key == 0)
  186. X!             key = mvwgetch (stdscr, y, x);
  187. X  
  188. X          have_key = 0;
  189. X          switch (key)            /*    any user keys or function keys    */
  190. X**************
  191. X*** 418,423
  192. X  #endif
  193. X          key = mvwgetch (stdscr, y, x);
  194. X  
  195. X          switch (key)            /*    any user keys or function keys    */
  196. X          {
  197. X              case FWD:
  198. X--- 432,438 -----
  199. X          if (have_key == 0)
  200. X              key = mvwgetch (stdscr, y, x);
  201. X  
  202. X+         have_key = 0;
  203. X          switch (key)            /*    any user keys or function keys    */
  204. X          {
  205. X              case FWD:
  206. X**************
  207. X*** 479,484
  208. X  
  209. X              case UND:
  210. X              case KEY_F(5):
  211. X              case KEY_UNDO:
  212. X                      return (UND);
  213. X                      break;
  214. X--- 494,500 -----
  215. X  
  216. X              case UND:
  217. X              case KEY_F(5):
  218. X+ #ifndef M_TERMCAP
  219. X              case KEY_UNDO:
  220. X  #endif
  221. X                      return (UND);
  222. X**************
  223. X*** 480,485
  224. X              case UND:
  225. X              case KEY_F(5):
  226. X              case KEY_UNDO:
  227. X                      return (UND);
  228. X                      break;
  229. X  
  230. X--- 496,502 -----
  231. X              case KEY_F(5):
  232. X  #ifndef M_TERMCAP
  233. X              case KEY_UNDO:
  234. X+ #endif
  235. X                      return (UND);
  236. X                      break;
  237. X  
  238. X**************
  239. X*** 520,528
  240. X                      {    if (isvalid (key))
  241. X                          {    wattrset (stdscr, A_STANDOUT);
  242. X                              waddch (stdscr, key);
  243. X- #ifdef M_TERMCAP
  244. X-                             wrefresh (stdscr);
  245. X- #endif
  246. X                              maybe_dirty = 1;
  247. X                              wbuf[byte_pos] = key;
  248. X                              reflect_change (byte_pos, HEX, wbuf);
  249. X--- 537,542 -----
  250. X                      {    if (isvalid (key))
  251. X                          {    wattrset (stdscr, A_STANDOUT);
  252. X                              waddch (stdscr, key);
  253. X                              maybe_dirty = 1;
  254. X                              wbuf[byte_pos] = key;
  255. X                              reflect_change (byte_pos, HEX, wbuf);
  256. X**************
  257. X*** 542,550
  258. X                              key = wgetch (stdscr);            /* 2nd nibble    */
  259. X                              if (isxdigit (key))
  260. X                              {    waddch (stdscr, key);
  261. X- #ifdef M_TERMCAP
  262. X-                                 wrefresh (stdscr);
  263. X- #endif
  264. X                                  hexb = key;
  265. X                              }
  266. X                              reflected = 1;
  267. X--- 556,561 -----
  268. X                              key = wgetch (stdscr);            /* 2nd nibble    */
  269. X                              if (isxdigit (key))
  270. X                              {    waddch (stdscr, key);
  271. X                                  hexb = key;
  272. X                              }
  273. X                              reflected = 1;
  274. X**************
  275. X*** 560,567
  276. X                          if (hexa || hexb)
  277. X                              reflect_change (byte_pos, ASC, wbuf);
  278. X                      }
  279. X!                     if (byte_pos < BSIZE - 1  &&  (reflected || key == ' '))
  280. X!                     {    byte_pos++;
  281. X                      }
  282. X                      wattrset (stdscr, 0);
  283. X                      if (key == UND  ||  key == KEY_F(5))
  284. X--- 571,584 -----
  285. X                          if (hexa || hexb)
  286. X                              reflect_change (byte_pos, ASC, wbuf);
  287. X                      }
  288. X!                     if ((key < 0  || key > 256)  &&  key != KEY_LEFT)     /*    function key ?? */
  289. X!                         have_key = 1;
  290. X!                     else
  291. X!                     {
  292. X!                         if (byte_pos < BSIZE - 1  &&  (reflected || key == ' ')
  293. X!                                 &&  key != KEY_LEFT)
  294. X!                         {    byte_pos++;
  295. X!                         }
  296. X                      }
  297. X                      wattrset (stdscr, 0);
  298. X  #ifdef M_TERMCAP
  299. X**************
  300. X*** 564,569
  301. X                      {    byte_pos++;
  302. X                      }
  303. X                      wattrset (stdscr, 0);
  304. X                      if (key == UND  ||  key == KEY_F(5))
  305. X                          return (UND);
  306. X                      break;
  307. X--- 581,587 -----
  308. X                          }
  309. X                      }
  310. X                      wattrset (stdscr, 0);
  311. X+ #ifdef M_TERMCAP
  312. X                      if (key == UND  ||  key == KEY_F(5))
  313. X  #else
  314. X                      if (key == UND  ||  key == KEY_F(5)  ||  key == KEY_UNDO)
  315. X**************
  316. X*** 565,570
  317. X                      }
  318. X                      wattrset (stdscr, 0);
  319. X                      if (key == UND  ||  key == KEY_F(5))
  320. X                          return (UND);
  321. X                      break;
  322. X          }
  323. X--- 583,591 -----
  324. X                      wattrset (stdscr, 0);
  325. X  #ifdef M_TERMCAP
  326. X                      if (key == UND  ||  key == KEY_F(5))
  327. X+ #else
  328. X+                     if (key == UND  ||  key == KEY_F(5)  ||  key == KEY_UNDO)
  329. X+ #endif
  330. X                          return (UND);
  331. X                      break;
  332. X          }
  333. END_OF_FILE
  334. if test 6789 -ne `wc -c <'patch01'`; then
  335.     echo shar: \"'patch01'\" unpacked with wrong size!
  336. fi
  337. # end of 'patch01'
  338. fi
  339. echo shar: End of shell archive.
  340. exit 0
  341.    
  342.  
  343.